package com.agent.user.feign;

import cn.hutool.core.bean.BeanUtil;
import com.agent.common.result.ApiResponse;
import com.agent.user.api.feign.UserAssetFeignClient;
import com.agent.user.api.req.UserAssetReq;
import com.agent.user.dto.UserAssetRequest;
import com.agent.user.service.UserAssetService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jeff_Wan
 * @description
 * @date 2025-08-08 16:45
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class UserAssetFeignClientImpl implements UserAssetFeignClient {

    private final UserAssetService userAssetService;

    @Override
    public ApiResponse<?> recordUserAsset(UserAssetReq request) {
        UserAssetRequest assetRequest = BeanUtil.copyProperties(request, UserAssetRequest.class);
        boolean result = userAssetService.recordUserAsset(assetRequest);
        return ApiResponse.judge(result);
    }
}
